package com.fjt.book_pay.dao;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import com.fjt.book_pay.pojo.P_Record;

public interface P_RecordDao {
	@Results({
		@Result(property = "buyer_name", column = "buyer_name"),
		@Result(property = "seller_name", column = "seller_name"),
		@Result(property = "type", column = "type"),
		@Result(property = "money", column = "money"),
		@Result(property = "date", column = "date")}
	)
	@Select("select * from p_record where id=#{id}")
	public P_Record selectMyRecord(P_Record p_Record);
	
	@Select("Select * from p_record where (buyer_name=#{username} or seller_name=#{username})")
	public List<P_Record> selectUserAllRecord(@Param("username") String username);
	
	@Insert("Insert into p_record VALUES(#{id},#{buyer_name},#{seller_name},#{type},#{money},#{date})")
	public boolean addRecord(P_Record p_Record);
}
